//
// Created by tang on 22-11-4.
//

#ifndef LEARNOPENGL_DRAG_HELPER_HPP
#define LEARNOPENGL_DRAG_HELPER_HPP

#include <functional>

struct GLFWwindow;

using DragAction = std::function<void(double, double)>;

class DragHelper final {
public:
    DragHelper(GLFWwindow *win);

    void InjectPress(bool primary);
    void InjectRelease();

    void InjectPosition(double x, double y);

    void SetActions(DragAction primary, DragAction secondly);

private:
    GLFWwindow *win_;
    bool active_;
    bool primary_;
    double last_position_x_;
    double last_position_y_;
    DragAction actions_[2];
};

#endif//LEARNOPENGL_DRAG_HELPER_HPP
